import random
from concurrent.futures import ThreadPoolExecutor
import time


def hello(num):
    time.sleep(random.randint(1, 3))
    print("{}只小鸭子，咿呀咿呀呦".format(num))


if __name__ == "__main__":
    executor = ThreadPoolExecutor(max_workers=3)
    for i in range(1, 6):
        future = executor.submit(hello, i)
        future.done()

    print("=" * 20)

    time.sleep(6)

    print("*" * 20)

    with ThreadPoolExecutor(3) as executor1:
        executor1.map(hello, [1, 2, 3, 4, 5, 6])
